package vn.allmobile.ambnews.activities.list;

import vn.allmobile.ambnews.R;
import vn.allmobile.ambnews.activities.detail.DetailActivity;
import vn.allmobile.ambnews.data.Article;
import vn.allmobile.ambnews.utils.Contants;
import vn.allmobile.ambnews.utils.GlobalApplication;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class ListItemClickListenner implements OnClickListener {	
	Article _article;
	Activity _activity;
	Context _context;
	
	ListItemClickListenner(Article article,Activity activity)
	{
		this._context = GlobalApplication._();
		this._article = article;
		_activity 	= activity;
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub			
			Intent itent = new Intent(_context,DetailActivity.class);
			Bundle extra  = new Bundle();
			extra.putString(Contants.EXTRA_DETAIL_PAPER, _article.getPaperId());
			extra.putString(Contants.EXTRA_DETAIL_CATEGORY, _article.getCatId());
			extra.putString(Contants.EXTRA_DETAIL_ID, _article.getId());
			itent.putExtras(extra);
			_activity.startActivity(itent);			
			_activity.overridePendingTransition(R.anim.slide_in_right,R.anim.no_animation);			
		
	}

}
